import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '设备名称',
    align: "center",
    dataIndex: 'devName'
  },
  {
    title: '设备序号',
    align: "center",
    dataIndex: 'devId'
  },
  {
    title: '故障时间',
    align: "center",
    dataIndex: 'faultDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '故障现象',
    align: "center",
    dataIndex: 'faultDescription'
  },
  {
    title: '保养/维修时间',
    align: "center",
    dataIndex: 'maintainDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '处理方式',
    align: "center",
    dataIndex: 'maintainMethod'
  },
  {
    title: '保养/维修工时(h)',
    align: "center",
    dataIndex: 'maintainHours'
  },
  {
    title: '维保人员/单位',
    align: "center",
    dataIndex: 'maintainPersonal_dictText'
  },
  // {
  //   title: '更换配件',
  //   align: "center",
  //   dataIndex: 'replaceModule'
  // },
  {
    title: '保养/维修内容及结果',
    align: "center",
    dataIndex: 'maintainDetails'
  },
  {
    title: '保养/维修证明',
    align: "center",
    dataIndex: 'maintainAtta',
    slots: { customRender: 'fileSlot' },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "设备序号",
    field: 'devId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "故障出现时间",
    field: 'faultDate',
    component: 'DatePicker',
    colProps: {span: 6},
  },
  {
    label: "保养(维修)时间",
    field: "maintainDate",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "维保人员(维修单位)",
    field: 'maintainPersonal',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '设备名称',
    field: 'devName',
    component: 'Input',
  },
  {
    label: '设备序号',
    field: 'devId',
    component: 'Input',
  },
  {
    label: '故障出现时间',
    field: 'faultDate',
    component: 'DatePicker',
  },
  {
    label: '故障现象',
    field: 'faultDescription',
    component: 'Input',
  },
  {
    label: '保养(维修)时间',
    field: 'maintainDate',
    component: 'DatePicker',
  },
  {
    label: '保养(故障)处理方式',
    field: 'maintainMethod',
    component: 'Input',
  },
  {
    label: '保养(维修)工时(h)',
    field: 'maintainHours',
    component: 'InputNumber',
  },
  {
    label: '维保人员(维修单位)',
    field: 'maintainPersonal',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '更换配件情况',
    field: 'replaceModule',
    component: 'Input',
  },
  {
    label: '保养(维修)内容及结果',
    field: 'maintainDetails',
    component: 'InputTextArea',
  },
  {
    label: '保养(维修)证明',
    field: 'maintainAtta',
    component: 'JUpload',
    componentProps:{
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
